<!DOCTYPE html>
<html lang="zh_CN">
<head>
<#--引入外部文件-->
    <#include "../common/header.ftl">
</head>
<body>

<div class="container" style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-3">
            <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">门票购买信息</h1>
                </div>
            </div>
        <#--高级查询--->
            <form class="form-inline" id="searchForm" action="/allticketeses/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <div class="form-group">
                    <label>关键字:</label>
                    <input type="text" class="form-control" name="keyword" value="${(qo.keyword)!}"
                           placeholder="请输入门票名称/用户名称">
                </div>
                <button id="btn_query" class="btn btn-default">
                    <span class="glyphicon glyphicon-search"></span> 查询
                </button>
            </form>

            <table class="table table-striped table-hover">
                <tr>
                    <th>编号</th>
                    <th>购买用户</th>
                    <th>门票</th>
                    <th>数量</th>
                    <th>购买时间</th>
                    <th>有效时间</th>
                    <th>类型</th>
                    <th>价格</th>
                    <th></th>
                </tr>
            <#--使用Freemark的指令完成循环迭代-->
                <#list pageInfo.list as entity>
                    <tr>
                        <td>${entity_index + 1}</td>
                        <td>${entity.user.nickName}</td>
                        <td>${entity.scenicName}</td>
                        <td>${entity.quantity}</td>
                        <td>${(entity.purchaseTime?string('yyyy-MM-dd HH:mm'))!}</td>
                        <td>${(entity.effectiveTime?string('yyyy-MM-dd HH:mm'))!}</td>
                        <td>
                    <#if entity.type==0 >
                        成人票
                    <#elseif entity.type==1>
                                    儿童票
                    </#if>

                        </td>
                        <td>${(entity.money)!}</td>
                        <td>
                            <a href="javascript:" class="btn btn-success btn-xs inputBtn" data-id="${entity.id}">
                                <span class="glyphicon glyphicon-pencil"></span> 删除
                            </a>
                        </td>
                    </tr>
                </#list>
            </table>

        <#include "../common/page.ftl">
        </div>
    </div>
</div>
<script>
    $(function () {
        $(".inputBtn").click(function () {
            var data = $(this).data("id");
            $.get("/allticket/delete.do", {id: data}, function (data) {
                    window.location.reload();
            })
        })
    })
</script>
</body>
</html>